# -*- coding:utf-8 -*-
import unittest
from survey import AnonymousSurvey 


class TestSuveyCase(unittest.TestCase):
	"""
	def test_store_single_response(self):
		question = "what language did you first learn to speak"
		my_survey = AnonymousSurvey(question)
		my_survey.store_response("english")
		
		self.assertIn('english',my_survey.responses)
		
	def test_store_three_response(self):
		question = "what language did you first learn to speak"
		my_survey = AnonymousSurvey(question)
		responses = ['english','japanese','chinese']
		for response in responses:
			my_survey.store_response(response)
		
		for response in responses:
			self.assertIn(response,my_survey.responses)"""
			
	#每个方法都创建了实例,每个方法都创建了答案,
	#setUp方法只需创建对像一次，每个test方法中使用它们，python先运行setUp方法，然后再运行各个以test开头的方法
	#tearDown用于在最后统一执行，和setUp类似
	
	
	def setUp(self):
		question = "what language did you first learn to speak"
		self.my_survey = AnonymousSurvey(question)
		self.responses = ['english','japanese','chinese']
		
	def test_store_single_response(self):
		self.my_survey.store_response(self.responses[0])
		self.assertIn(self.responses[0],self.my_survey.responses)
	
	def test_store_three_response(self):
		for response in self.responses:
			self.my_survey.store_response(response)
		
		for response in self.responses:
			self.assertIn(response,self.my_survey.responses)
	
		
		
if __name__ == "__main__":
	unittest.main()
		